package com.cusc.lib_api.bean.department;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * 作者: wangfei
 * 创建时期: 2020/4/9.
 * 包名: com.cusc.lib_api.bean.department
 * 类名: OSAndroidMvvm
 */
public class NodeDepartment implements Serializable {
    protected String parentId; /*父节点的id*/
    protected String id; /*机构部门ID 格式:appSysId_appDeptId*/
    protected String text;/*机构部门名称*/
    protected String extra;/*	{terminalStatus}{hostCurStatus}{vehStatus}:{vehStatusDesc}*/
    protected int nodeType;/*节点类型，1:机构 2:部门 3:车辆 4:人员*/
    protected int leaf; /*是否有子节点 0:是 1:不是*/
    protected String iconCls;/*数的展示图标名 sys:机构 dept:部门 car_offline:离线车辆图标 car_online:在线车辆图标*/
    private ArrayList<NodeDepartment> children;
    private boolean showChildren;
    private int checkNode;//是否选择 0:不选择 1:子节点有些数据没有被选择 2:全选

    public NodeDepartment() {
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getExtra() {
        return extra;
    }

    public void setExtra(String extra) {
        this.extra = extra;
    }

    public int getNodeType() {
        return nodeType;
    }

    public void setNodeType(int nodeType) {
        this.nodeType = nodeType;
    }

    public int getLeaf() {
        return leaf;
    }

    public void setLeaf(int leaf) {
        this.leaf = leaf;
    }

    public String getIconCls() {
        return iconCls;
    }

    public void setIconCls(String iconCls) {
        this.iconCls = iconCls;
    }

    public ArrayList<NodeDepartment> getChildren() {
        return children;
    }

    public void setChildren(ArrayList<NodeDepartment> children) {
        this.children = children;
    }

    public boolean isShowChildren() {
        return showChildren;
    }

    public void setShowChildren(boolean showChildren) {
        this.showChildren = showChildren;
    }

    public int getCheckNode() {
        return checkNode;
    }

    public void setCheckNode(int checkNode) {
        this.checkNode = checkNode;
    }

    /**
     * 选择当前根节点下的所有子节点都被选择
     */
    public void setAllLeafChoose(ArrayList<NodeDepartment> children){
        if (children != null){
            for (int i = 0;i < children.size();i++){
                children.get(i).setCheckNode(2);
                setAllLeafChoose(children.get(i).children);
            }
        }
    }

    @Override
    public String toString() {
        return "NodeDepartment{" +
                "parentId='" + parentId + '\'' +
                ", id='" + id + '\'' +
                ", text='" + text + '\'' +
                ", extra='" + extra + '\'' +
                ", nodeType=" + nodeType +
                ", leaf=" + leaf +
                ", iconCls='" + iconCls + '\'' +
                ", children=" + children +
                ", showChildren=" + showChildren +
                ", checkNode=" + checkNode +
                '}';
    }
}
